import { Equal } from "@type-challenges/utils";

export type IndexOf<T, U, Result extends any[] = []> = T extends [
  infer F,
  ...infer Rest
]
  ? Equal<F, U> extends true
    ? Result["length"]
    : IndexOf<Rest, U, [...Result, any]>
  : -1;

type Result555 = IndexOf<[string, 1, number, "a"], number>;
